package com.yue.yadmin.enums;
/**
 * 常用布尔枚举：0否，1是
 * 廖欣跃
 * Wed May 30 22:05:08 CST 2018
 */
public enum EnumBool {
	/**
	 *[0,"否"]
	 */
	FALSE(0,"否"),
	/**
	 *[1,"是"]
	 */
	TRUE(1,"是");
	private int code;
	private String desc;
	public void setCode(int code){
		this.code=code;
	}
	public int getCode(){
		return code;
	}
	public void setDesc(String desc){
		this.desc=desc;
	}
	public String getDesc(){
		return desc;
	}
	private EnumBool(int code,String desc){
		this.code=code;
		this.desc=desc;
	}
	/**
	 * 查找枚举,不存在返回null
	 */
	public static EnumBool getEnum(Integer code,String desc){
		for(EnumBool e:values()){
			if((code!=null&&e.getCode()==code)||(desc!=null&&e.getDesc().equals(desc))){
				return e;
			}
		}
		return null;
	}
}
